import request from '@/utils/request'
import axios from 'axios'

axios.defaults.baseURL = 'http://localhost:8000'; // 后端接口地址

// 获取推广
export function getList() {
    return request(({
        url: '/promotion/all',
        method: 'get'
    }))
}

export function addPromote(promotion) {
    return request({
        url: '/promotion/add',
        method: 'post',
        data: promotion
    })
}

export function deletePromote(id) {

    return axios.delete('/promotion/delete/' + id)
    // }))
}

export function updatePromote(data) {
    return request({
        url: '/promotion/update',
        method: 'post',
        data: data
    })
}

export function getPromotion(searchText) {
    return axios.get('/promotion/list?keyword=' + searchText)
}